import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

    public class demo {
        public static void main(String[] args) {
            Collection collection = new ArrayList(); //创建一个collection对象
            Collection collection1 = new ArrayList();
            // (1) 添加元素
            collection.add(1);
            collection.add(2);
            collection.add(3);
            collection.add(4);
            collection.add(5);

//        for (Object obj : collection) {
//            System.out.println(obj);
//        }

            Iterator it = collection.iterator();
            while (it.hasNext()) {
                System.out.println(it.next());
                collection.remove(it.next());
            }
            System.out.println(collection);
        }
    }
